<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 团购点评图片表
 */
class CommentImg extends Model
{
    public $timestamps = false;

    protected $table = 'comment_img';

    protected $fillable = [
        'id',
        'comment_id',
        'url',
        'url_oss',
    ];

    protected $casts = ['url'];

    public function getUrlAttribute($value)
    {
        return \App\Library\HandleFile::handleFilePath($value, $this->url_oss);
    }

    //关联用户评价
    public function user_comment()
    {
        return $this->hasOne('App\\Models\\UserComment', 'comment_id', 'comment_id');
    }
}
